<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>3d旋转</title>
    <style>
        body{
            background: #cccccc;
        }
        .item{
            width: 220px;
            margin: 50px auto;
            height: 276px;
            cursor: pointer;
            position: relative;
            perspective: 500px;
        }
        .item img{
            max-width: 220px;
            width: 100%;
            height: 150px;
        }
       .item .front,.item .back{
          position: absolute;
           left:0;
           top:0;
           width: 100%;
           height: 100%;
           background: #fff;
           overflow: hidden;
           perspective: 1000px;
           box-shadow: rgba(50, 50, 50, 0.8) 0 0 15px;
           transition: all 1.5s;
           backface-visibility:hidden  /*(该属性定义当元素不面向屏幕时是否可见）*/
       }
        /*先让back选择-180deg*/
        .back{
            position: relative;
            transform: rotateY(-180deg);
        }
        /*鼠标放上去去 前面那张图片选择 -180deg*/
        .item:hover .front{
            transform: rotateY(-180deg);
        }

        .item:hover .back{
            transform: rotateY(-360deg);
        }

        p{
            padding: 0 12px;
            font-size: 14px;
            color: #939393;
        }
    </style>
</head>
<body>
     <div class="item">
          <div class="front">
              <img src="front.png" alt="">
              <p>我是正面</p>
          </div>
          <div class="back">
              <img src="back.jpeg" alt="">
              <p>我是反面</p>
          </div>
     </div>
</body>
</html>
